// 实现withRouter
import React from 'react';
import { useLocation, useNavigate, useParams } from 'react-router-dom';

export default function withRouter(Child) {
    return function(props) {
      const location = useLocation();
      const navigate = useNavigate();
      const params = useParams();
      return <Child {...props} navigate={navigate} params={params} location={location} />;
    }
  }
